package com.scuec.tourismwebsite.mapper;

import com.scuec.tourismwebsite.entity.TodayDataOverview;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

@Mapper
public interface TodayDataOverviewMapper {


    @Select("SELECT * FROM today_data_overview")
    List<TodayDataOverview> selectTodayDataOverview();

    @Select("SELECT * FROM today_data_overview WHERE date = #{date}")
    TodayDataOverview selectTodayDataOverviewByDate(String date);


    @Insert("INSERT INTO today_data_overview(date, visitors_today, new_users_today, orders_today, " +
            "new_visitors_today, new_registered_today, new_orders_today, current_online_users) " +
            "VALUES(#{date}, #{visitors_today}, #{new_users_today}, #{orders_today}, " +
            "#{new_visitors_today}, #{new_registered_today}, #{new_orders_today}, #{current_online_users})")
    int insertTodayDataOverview(TodayDataOverview todayData);
}
